package com.example.javaairportflightanalysis.dao.sql;

import io.micrometer.common.util.StringUtils;
import org.apache.ibatis.jdbc.SQL;

public class BaseApueProvider {

    public String searchAiso(String ddtm,String cnnm) {
        return new SQL(){{
            SELECT("DDTM,CNNM,ENNM,APSN,AISO");
            FROM("VW_META_BASE_APUE");
            if (StringUtils.isNotBlank(ddtm)) {
                WHERE("ddtm like '%${ddtm}%'");
            }
            if (StringUtils.isNotBlank(cnnm)) {
                WHERE("cnnm like '%${cnnm}%'");
            }
        }}.toString();
    }
}
